import $qs from 'qs';
import store from '../store/index';

function commitLogin() {
  const cookies = $qs.parse(document.cookie);
  if (cookies) {
    var uuid = cookies['bgmg.sess'];
    store.commit('user/loginStatus', !!uuid);
  } else {
    store.commit('user/loginStatus', false);
  }
}

function hasLogin() {
  return store.getters['user/hasLogin'];
}

export { commitLogin, hasLogin };
